/**
 * @ClassName Student
 * @Description 学生类
 * @Author Li
 * @Date 2022/8/1 9:12
 * @ModifyDate 2022/8/1 9:12
 * @Version 1.0
 */
public class Student {
    private String name;
    private int age;
    // 学号
    private int sid;

    // 类变量，记录学生数量，分配学号
    static int idCounter = 0;

    public Student() {
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
        // 通过idCounter给学生分配学号
        this.sid = ++idCounter;
    }

    // 打印属性值
    public void show() {
        System.out.println("Student:sid=" + sid + ",name" + name + ",age=" + age);
    }

    public static void showCount() {
        System.out.println("Count:" + idCounter);
    }
}
